package com.example.glblend;

import android.content.Context;
import android.opengl.GLES20;

public class ImageShaderProgram extends ShaderProgram {

    private int aPosition;

    private int a_TextureCoord;

    private int u_Sampler;

    public ImageShaderProgram(Context context) {
        super(context, R.raw.image_vertex, R.raw.image_fragment);
        aPosition = GLES20.glGetAttribLocation(program, "a_Position");
        a_TextureCoord = GLES20.glGetAttribLocation(program, "a_TextureCoord");
        u_Sampler = GLES20.glGetAttribLocation(program, "u_Sampler");
    }

    public void setUniform(int texture) {
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture);
        GLES20.glUniform1i(u_Sampler, 0);
    }

    public int getaPosition() {
        return aPosition;
    }

    public int getA_TextureCoord() {
        return a_TextureCoord;
    }
}
